perm filename NEWD[E,ALS] blob sn#260180 filedate 1977-01-27 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	NEWDLI
C00006 ENDMK
CāŠ—;
;NEWDLI

;This code inserts a new first line, listing all labels which end with a :
NEWDLI:	PUSHJ P,ENDSET		;To guarentee that new line will be at the end of FS
	TLO F,NOCHK		;Don't CORE DOWN untill through
	TRO F,UPDTXT		;This is the first line on the page
	HRRZ B,PAGE		;Start at top of page
	HRRZ H,FSEND
	ADDI H,1
	HLLZ Q,TXTFLG(B)	;Save flags
LEG	HLLM Q,TXTFLG(H)
	AOS TT,TXTNUM
LEG	HRRM TT,TXTSER(H)	;Assign H new serial number
;Link up new area as first line on page
	HRLM B,(H)
	HRRM A,(H)
	HRRM H,PAGE
	HRLM H,(B)
	MOVE I,H
	ADD H,[440700,,LLDESC]	;Pointer for depositing text
	MOVEI C.73		Start with a ;
LEG	IDPB C,H
	MOVEI E,40
	MOVEI G,1		;Count the ;
NEWD1:	HRRZ T,TXTCNT(B)
	JUMPE T,NEWD4		;Blank line bypass
	MOVSI T,-10
	MOVE D,B
	ADD D,[440700,,LLDESC]
NEWD2:	MOVEM D,DSAVE#
	ILDB C,D
	CAIE C,40
	CAIN C,11
	JRST NEWD2		;Ignore initial spaces and TABS
	SKIPA
;Check line for a label
NEWD3:	ILDB C,D
	CAIN C,72		;Is it a :
	JRST NEWD5
	CAIE C,15		;Are we at the end of the line?
	AOBJN T,NEWD3
NEWD4:	MOVE B,(B)		;Go to the next line
	CAME B,BOTSTR
	JRST NEWD1		;and try again
	MOVEI C,15
LEG	IDPB C,H
	MOVEI C.12
LEG	IDPB C,H
	TDZA C,C
LEG	IDPB C,H		;And a null
	TLNE H,760000
	JRST .-2
	MOVSI TT,2(G)		;2 for CRLF + char. count
	ADDI TT,(G)		;but only char. count into right half
	ADDM TT,TXTCNT(I)	;Record char counts
	AOS LINES		;Add to line count
	HLRZ T,TXTCNT(I)
	ADDM T,CHARS	 	;Add to char count
	HRRZ T,TXTCNT(I)
	OUTSTR [ASCIZ/
THE new directory line prints /]
	SETZM TYOPNT
	TYPDEC T
	OUTSTR [ASCIZ/ characters. /]
	MOVE T,I
;Display text must be in ASCID
	ADDI T,LLDESC		;Get address of first text word
	MOVEI TT,1
	IORM TT,(T)		;Convert to ASCID
	CAIGE T,(H)
	AOJA T,.-2
	MOVEI TT,2(H)
	MOVSI T,TXTCOD
	FSFIX TT,T
	PUSHJ P,ENDFIX
	TLZ F,NOCHK
	MOVEI A,1
	PUSHJ P,SETARR
	PUSHJ P,LINSET
	JRST SETWRT

NEWD5:	MOVE D,DSAVE		;Go back and copy this label
	HRRZS T	
NEWD6:	ILDB C,D
LEG	IDPB C,H
	AOS G
	SOJG T,NEWD6
LEG	IDPB E,H
	AOS G
	JRST NEWD4